package org.monte.previo2;


import java.util.List;

import org.monte.previo2.base.ManagerDB;
import org.monte.previo2.camara.CameraActivity;

import org.monte.previo2.clases.Imagen;

import org.monte.previo2.servicios.Sincronizar;



import android.os.Bundle;


import android.app.Activity;
import android.app.AlertDialog;

import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;



import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;

import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class DebugActivity extends Activity{
	
	ManagerDB manger;
	private ListView lista_previos;
    
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		lista_previos = (ListView) findViewById(R.id.listView_principal);

		manger= new ManagerDB(this);
		
		final List<Imagen> app_list = manger.getAllImages();
		ArrayAdapter<Imagen> arrAdapter = new ArrayAdapter<Imagen>(this, android.R.layout.simple_list_item_2,android.R.id.text1,app_list){
		
	            @Override
	            public View getView(int position, View convertView, android.view.ViewGroup parent) {
	            	
	                View view = super.getView(position, convertView, parent);
	 
	                Imagen entry = app_list.get(position);
	                TextView text1 = (TextView) view.findViewById(android.R.id.text1);
	                text1.setTextColor(Color.WHITE);
	                
	                TextView text2 = (TextView) view.findViewById(android.R.id.text2);
	             //   text1.setText("Id:"+entry.getIdImagen()+" Enviada?:"+entry.getEnviada()+" idApp:"+entry.getAplicacion().getIdAplicacio()+" "+entry.getNombre());
	                text2.setText("Tipo: "+entry.getTipo().getIdTipo() + " Cmt:" + entry.getComentario()+" URL:"+entry.getUrl());
	                text2.setTextColor(Color.WHITE);
	                text1.setGravity(android.view.Gravity.CENTER);
	                text2.setGravity(android.view.Gravity.CENTER);
	        
	                return view;
	            }
	        };
		lista_previos.setAdapter(arrAdapter);	
	}
	
	@Override
	protected void onResume() {
		super.onResume();		
	}		
	
}
